package silo.dungeonbuddy;

//import java.util.ArrayList;
import java.util.Vector;

public class Board
{
	private int height=100;
	private int width=100;
	private Vector units = new Vector();
	private Vector terrain = new Vector();
	private Vector markers = new Vector();
	private Vector effects = new Vector();
	private Vector objects = new Vector();
	//private Square[][] squareList = new Square[width][height];
	private Vector squareList = new Vector();
	private Background background;
	
	public Board(int height, int width, Background eBack, Vector eUnits, Vector eTerrain)
	{
		this.height=height;
		this.width=width;
		this.squareList = new Vector();
		for(int i=0; i<height;i++)
		{
			squareList.add(new Vector());
		}//next i
		background=eBack;
		units=eUnits;
		terrain=eTerrain;
	}
	
	//GETTERS
	public int getHeight()
	{
		return height;
	}
	public int getWidth()
	{
		return width;
	}
	public Vector getSquareList()
	{
		return squareList;
	}
	public Vector getUnits()
	{
		return units;
	}
	public Vector getTerrain()
	{
		return terrain;
	}
	public Vector getMarkers()
	{
		return markers;
	}
	public Vector getEffects()
	{
		return effects;
	}
	public Vector getObjects()
	{
		return objects;
	}
	public Background getBackground()
	{
		return background;
	}
	
	//SETTERS
	public void setHeight(int eHeight)
	{
		height=eHeight;
	}
	public void setWidth(int eWidth)
	{
		width=eWidth;
	}
	public void setSquareList(Vector eList)
	{
		squareList = eList;
	}
	public void setUnits(Vector eUnits)
	{
		units=eUnits;
	}
	public void setTerrain(Vector eTerrain)
	{
		terrain=eTerrain;
	}
	public void setMarkers(Vector eMarkers)
	{
		markers=eMarkers;
	}
	public void setEffects(Vector eEffects)
	{
		effects=eEffects;
	}
	public void setObjects(Vector eObjects)
	{
		objects=eObjects;
	}
	public void setBackground(Background eBack)
	{
		background=eBack;
	}
	
	//toString
	public String toString()
	{
		//TODO: Set up the toString() and client to work with terrains.
		//TODO: Set up the toString() and client to work with markers.
		//TODO: Set up the toString() and client to work with effects.
		//TODO: Set up the toString() and client to work with objects.
		String s = "";
		s = background.toString() + "," + height + "," + width + "," + units.size() + ",";
		for(int i=0;i<units.size();i++)
		{
			try
			{
				Unit u = (Unit)units.get(i);
				s = s + u.toString();
			}catch(Exception e)
			{
				
			}//catch
		}//next i
		s = s + terrain.size() + ",";
		for(int i=0;i<terrain.size();i++)
		{
			try
			{
				Terrain t = (Terrain)terrain.get(i);
				s = s + t.toString();
			}catch(Exception e)
			{
				
			}//catch
		}//next i
		s = s + markers.size() + ",";
		for(int i=0;i<markers.size();i++)
		{
			try
			{
				Marker m = (Marker)markers.get(i);
				s = s + m.toString();
			}catch(Exception e)
			{
				
			}//catch
		}//next i
		s = s + objects.size() + ",";
		for(int i=0;i<objects.size();i++)
		{
			try
			{
				Object o = (Object)objects.get(i);
				s = s + o.toString();
			}catch(Exception e)
			{
				
			}//catch
		}//next i
		s = s + effects.size() + ",";
		for(int i=0;i<effects.size();i++)
		{
			try
			{
				Effect e = (Effect)effects.get(i);
				s = s + e.toString();
			}catch(Exception e)
			{
				
			}//catch
		}//next i
		s = s + ";";
		return s;
	}//toString
}//class Board